package models

import "gorm.io/gorm"

// 问题结构体

type Question struct {
	gorm.Model
	Title        string       `gorm:"type:varchar(100)" json:"title"`
	Content      string       `gorm:"type:text" json:"content"`
	Img          string       `gorm:"type:varchar(255)" json:"img"`
	CateId       uint         `gorm:"type:int(10)"`
	QuestionType QuestionType `gorm:"foreignKey:CateId"`
	Answers      []Answer
}

// 问题分类表

type QuestionType struct {
	gorm.Model
	Name string `gorm:"type:varchar(100)" json:"name"`
}

// 答案表

type Answer struct {
	gorm.Model
	Content    string   `gorm:"type:varchar(100)" json:"content"`
	QuestionId uint     `gorm:"type:int(10)" json:"questionId"`
	Question   Question `gorm:"foreignKey:QuestionId"`
}

// 视频

type Video struct {
	gorm.Model
	Title     string    `gorm:"type:varchar(100)" json:"title"`
	Content   string    `gorm:"type:varchar(255)" json:"content"`
	VideoSrc  string    `gorm:"type:varchar(255)"  json:"videoSrc"`
	CateId    uint      `gorm:"type:int(10)"  json:"cateId"`
	VideoCate VideoCate `gorm:"foreignKey:CateId"`
}

// 视频分类

type VideoCate struct {
	gorm.Model
	Name string `gorm:"type:varchar(30)" json:"name"`
}
